package org.example;

import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.messaging.SessionDisconnectEvent;

// 4. 监听 STOMP 断开事件
@Component
public class StompEventListener {
    @EventListener
    public void handleDisconnect(SessionDisconnectEvent event) {
        System.out.println("[STOMP] 连接断开: " + event.getSessionId() + 
                         ", 原因: " + event.getCloseStatus());
        System.out.println(event.getSource());
    }
}